package com.link.base.base.weibo.service;

import javax.annotation.Resource;

import com.link.core.basic.service.ServiceException;
import com.link.base.base.weibo.dao.mybatis.mapper.WeiboUserMapper;
import org.springframework.stereotype.Service;
import com.link.base.base.weibo.model.WeiboUser;
import com.link.core.basic.dao.mapper.BasicMapper;
import com.link.core.basic.service.BasicServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Set;

/**
 * @author: 郭闪
 * @date: 2019-02-19
 * @comments:
 */
@Service
public class WeiboUserServiceImpl extends BasicServiceImpl<WeiboUser> implements WeiboUserService {

    @Resource
    private WeiboUserMapper weiboUserMapper;

    @Override
    public BasicMapper<WeiboUser> getBasicMapper() {
        return weiboUserMapper;
    }

    @Override
    public Set<String> queryExistUserIds(Set<String> ids) {
        return weiboUserMapper.queryExistUserIds(ids);
    }

    @Transactional(
        rollbackFor = {ServiceException.class}
        )
    @Override
    public void usersInsert(List users) throws Exception {
        for (int i = 0; users != null && i < users.size(); ++i) {
            weiboUserMapper.insertUser(users.get(i));
        }
    }


}

